<?php 
require_once("../includes/config.php"); 

   if($_SERVER["REQUEST_METHOD"] == "POST" && isset($_GET)){
      $sql= query("INSERT INTO sub_services (service_id , sub_serv_name ,sub_serv_price) VALUES (?,? ,?)",$_GET['id'],$_POST['sub_name'],$_POST['price']);

	   $_SESSION['success_message'] = "تم اضافة الخده الفرعيه بنجاح"; 
	   $servs=query("SELECT * FROM services WHERE service_id =?",$_GET['id']);
	$sub_servs=query("SELECT * FROM sub_services WHERE service_id =?",$_GET['id']);
	   redirect("sub_services-settings.php?id=".$_GET['id']);
      }  

    $servs=query("SELECT * FROM services WHERE service_id =?",$_GET['id']);
	$sub_servs=query("SELECT * FROM sub_services WHERE service_id =?",$_GET['id']);
  render("/settings/sub_sevices.php", array("title"=> "الخدمات الفرعيه لل". $servs[0]["service_name"],"servs"=>$servs,"sub_servs"=>$sub_servs));
 
?>